home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / KOOB / creator / ui / GuiEditorGui.gui < prev    next >
Text File  |  2005-11-23  |  21KB  |  657 lines

  1. //----------------------------------------------------------------
  2.  
  3. new GuiControlProfile (BackFillProfile)
  4. {
  5.    opaque = true;
  6.    fillColor = "0 94 94";
  7.    border = true;
  8.    borderColor = "255 128 128";
  9.    fontType = "Arial";
  10.    fontSize = 12;
  11.    fontColor = "0 0 0";
  12.    fontColorHL = "32 100 100";
  13.    fixedExtent = true;
  14.    justify = "center";
  15. };
  16.  
  17. new GuiControl(GuiEditorGui) {
  18.    profile = GuiDefaultProfile;
  19.    position = "0 0";
  20.    extent = "800 600";
  21.    helpPage = "3. Gui Editor";
  22.    new GuiMenuBar(GuiEditorMenuBar) {
  23.       profile = "GuiMenuBarProfile";
  24.       horizSizing = "width";
  25.       vertSizing = "bottom";
  26.       position = "0 0";
  27.       extent = "800 22";
  28.       minExtent = "8 8";
  29.       visible = "1";
  30.       helpTag = "0";
  31.    };
  32.    new GuiFrameSetCtrl()
  33.    {
  34.       position = "0 22";
  35.       extent = "800 578";
  36.       profile = "GuiButtonProfile";
  37.       horizSizing = "width";
  38.       vertSizing = "height";
  39.       columns = "0 640";
  40.       rows = "0";
  41.  
  42.       new GuiControl() {
  43.          position = "0 0";
  44.          extent = "640 578";
  45.          minExtent = "64 64";
  46.          horizSizing = "width";
  47.          vertSizing = "height";
  48.          profile = GuiDefaultProfile;
  49.          //----------------------------------------
  50.          // toolbar
  51.          new GuiControl() {
  52.             profile = "GuiWindowProfile";
  53.             horizSizing = "width";
  54.             vertSizing = "bottom";
  55.             position = "0 0";
  56.             extent = "640 28";
  57.  
  58.             new GuiControlListPopup(GuiEditorClassPopup)
  59.             {
  60.                   profile = "GuiEditorClassProfile";
  61.                   position = "8 6";
  62.                   extent = "180 16";
  63.             };
  64.             new GuiPopUpMenuCtrl(GuiEditorContentList)
  65.             {
  66.                   profile = "GuiEditorClassProfile";
  67.                   position = "196 6";
  68.                   extent = "180 16";
  69.             };
  70.             new GuiPopUpMenuCtrl(GuiEditorResList)
  71.             {
  72.                   profile = "GuiEditorClassProfile";
  73.                   position = "382 6";
  74.                   extent = "180 16";
  75.             };
  76.          };
  77.          new GuiEditorRuler(GuiEditorTopRuler) {
  78.             position = "10 28";
  79.             extent = "630 10";
  80.             horizSizing = "width";
  81.             vertSizing = "bottom";
  82.             profile = "GuiButtonProfile";
  83.             refCtrl = GuiEditorScroll;
  84.          };
  85.          new GuiEditorRuler(GuiEditorLeftRuler) {
  86.             position = "0 38";
  87.             extent = "10 540";
  88.             horizSizing = "right";
  89.             vertSizing = "height";
  90.             profile = "GuiButtonProfile";
  91.             refCtrl = GuiEditorScroll;
  92.          };
  93.          new GuiScrollCtrl(GuiEditorScroll) 
  94.          {
  95.             profile = "GuiScrollProfile";
  96.             position = "10 38";
  97.             extent = "630 540";
  98.             horizSizing = "width";
  99.             vertSizing = "height";
  100.             vScrollBar = "dynamic";
  101.             hScrollBar = "dynamic";
  102.  
  103.             new GuiControl(GuiEditorRegion)
  104.             {
  105.                profile = "GuiDefaultProfile";
  106.                horizSizing = "right";
  107.                vertSizing = "bottom";
  108.                position = "0 0";
  109.                extent = "640 480";
  110.  
  111.                new GuiControl() // background
  112.                {
  113.                   profile = "BackFillProfile";
  114.                     horizSizing = "width";
  115.                     vertSizing = "height";
  116.                   position = "0 0";
  117.                   extent = "640 480";
  118.                };
  119.                new GuiControl(GuiEditorContent)
  120.                {
  121.                   profile = "GuiDefaultProfile";
  122.                     horizSizing = "width";
  123.                     vertSizing = "height";
  124.                   position = "0 0";
  125.                   extent = "640 480";
  126.                };
  127.                new GuiEditCtrl(GuiEditor)
  128.                {
  129.                   profile = "GuiTextEditProfile"; // so it's tabable
  130.                     horizSizing = "width";
  131.                     vertSizing = "height";
  132.                   position = "0 0";
  133.                   extent = "640 480";
  134.                };
  135.             };
  136.          };
  137.       };
  138.       new GuiFrameSetCtrl()
  139.       {
  140.          position = "640 0";
  141.          minExtent = "128 64";
  142.          extent = "160 600";
  143.          profile = "GuiButtonProfile";
  144.          horizSizing = "width";
  145.          vertSizing = "height";
  146.          columns = "0";
  147.          rows = "0 300";
  148.          //----------------------------------------
  149.          // Tree View
  150.            new GuiScrollCtrl() 
  151.          {
  152.             profile = "GuiScrollProfile";
  153.                minExtent = "72 64";
  154.                position = "0 0";
  155.                extent = "160 300";
  156.                horizSizing = "width";
  157.                vertSizing = "height";
  158.                vScrollBar = "alwaysOn";
  159.                hScrollBar = "dynamic";
  160.  
  161.                new GuiTreeViewCtrl(GuiEditorTreeView)
  162.             {
  163.                profile = "GuiTreeViewProfile";
  164.                    position = "0 0";
  165.                    horizSizing = "width";
  166.                };
  167.            };
  168.          //----------------------------------------
  169.          // Inspector
  170.          new GuiControl() { 
  171.             profile = "GuiInspectorBackgroundProfile";
  172.             horizSizing = "width";
  173.             vertSizing = "height";
  174.             position = "0 0";
  175.             extent = "160 300";
  176.             minExtent = "64 64";
  177.             fillColor = "128 128 128";
  178.          
  179.             new GuiButtonCtrl () {
  180.                profile = "GuiInspectorTypeFileNameProfile";
  181.                  position = "6 3";
  182.                  border = 5;
  183.                  extent = "40 20";
  184.                  text = "Apply";
  185.                  command = "GuiEditorInspectApply();";
  186.              };
  187.  
  188.              new GuiTextCtrl() {
  189.                profile = "GuiInspectorFieldProfile";
  190.                  position = "52 4";
  191.                  extent = "42 16";
  192.                  text = "Name:";
  193.              };
  194.  
  195.              new GuiTextEditCtrl (GuiEditorInspectName) {
  196.                profile = "GuiInspectorBackgroundProfile";
  197.                  position = "97 4";
  198.                  extent = "62 18";
  199.                  text = "";
  200.                  horizSizing = "width";
  201.                  AltCommand = "GuiEditorInspectApply();";
  202.                  vertSizing = "bottom";
  203.                autoSizeWidth = false;
  204.                autoSizeHeight = true;
  205.                textOffset = "0 2";
  206.              };
  207.  
  208.              new GuiScrollCtrl() {
  209.                profile = "GuiScrollProfile";
  210.                  position = "0 26";
  211.                  extent = "160 274";
  212.                  horizSizing = "width";
  213.                  vertSizing = "height";
  214.                  vScrollBar = "alwaysOn";
  215.                  hScrollBar = "alwaysOff";
  216.  
  217.                   new GuiInspector (GuiEditorInspectFields) {
  218.                   useFieldGrouping = false;
  219.                   profile = "GuiDefaultProfile";
  220.                       position = "0 0";
  221.                       extent = "140 0";
  222.                       horizSizing = "width";
  223.                       vertSizing = "bottom";
  224.                  };
  225.              };
  226.          };
  227.       };
  228.  
  229.    };
  230. };
  231.  
  232.  
  233. //----------------------------------------
  234. new GuiControl(NewGuiDialog)
  235. {
  236.    profile = "GuiDialogProfile";
  237.    position = "0 0";
  238.    extent = "640 480";
  239.    
  240.     new GuiWindowCtrl()
  241.    {
  242.       profile = "GuiWindowProfile";
  243.         position = "220 146";
  244.         extent = "200 188";
  245.         text = "Create new GUI";
  246.       canMove = "false";  
  247.       canClose = "false";
  248.       canMinimize = "false";
  249.       canMaximize = "false";
  250.       horizSizing = "center";
  251.       vertSizing = "center";
  252.       
  253.         new GuiTextCtrl()
  254.       {
  255.          profile = "GuiTextProfile";
  256.             position = "20 28";
  257.             text = "GUI Name:";
  258.         };
  259.         new GuiTextEditCtrl(NewGuiDialogName)
  260.       {
  261.          profile = "GuiTextEditProfile";
  262.             position = "20 44";
  263.             extent = "160 20";
  264.         };
  265.         new GuiTextCtrl()
  266.       {
  267.          profile = "GuiTextProfile";
  268.             position = "20 68";
  269.             text = "Class:";
  270.         };
  271.         new GuiControlListPopup(NewGuiDialogClass)
  272.       {
  273.          profile = "GuiControlListPopupProfile";
  274.             position = "20 84";
  275.             extent = "160 20";
  276.         };
  277.         new GuiButtonCtrl() {
  278.          profile = "GuiButtonProfile";
  279.             position = "56 156";
  280.             extent = "40 16";
  281.             text = "Create";
  282.             command = "GuiEditorCreate();";
  283.         };
  284.         new GuiButtonCtrl() {
  285.          profile = "GuiButtonProfile";
  286.             position = "104 156";
  287.             extent = "40 16";
  288.             text = "Cancel";
  289.             command = "Canvas.popDialog(NewGuiDialog);";
  290.         };
  291.    };
  292. };
  293.  
  294.  
  295. //----------------------------------------
  296. function GuiEditorStartCreate()
  297. {
  298.    NewGuiDialogClass.setText("GuiControl");
  299.    NewGuiDialogClass.sort();
  300.    NewGuiDialogName.setValue("NewGui");
  301.    Canvas.pushDialog(NewGuiDialog);
  302. }
  303.  
  304. //----------------------------------------
  305. function GuiEditorCreate()
  306. {
  307.    %name = NewGuiDialogName.getValue();
  308.    %class = NewGuiDialogClass.getText();
  309.    Canvas.popDialog(NewGuiDialog);
  310.    %obj = eval("return new " @ %class @ "(" @ %name @ ");");
  311.    GuiEditorOpen(%obj);
  312. }
  313.  
  314. //----------------------------------------
  315. function GuiEditorSaveGui()
  316. {
  317.    %obj = GuiEditorContent.getObject(0);
  318.    if(%obj == -1 || %obj.getName() $= "")
  319.       return;
  320.    %name = %obj.getName() @ ".gui";
  321.    if ($BlockSave!=1) {
  322.       getSaveFilename("*.gui", "GuiEditorSaveGuiCallback", %name);
  323.    } else {
  324.       echo("To enable gui saving, make \$BlockSave=1.");
  325.       MessageBoxOK("Save Function Disabled","The Save GUI function has been disabled for this demo walkthrough.\n\n  If you are sure you want to make permanent GUI changes, go to the console (tilde \"~\" key) and type \"$BlockSave=0;\" first.");
  326.    }
  327. }
  328.  
  329. function GuiEditorSaveGuiCallback(%name)
  330. {
  331.    %obj = GuiEditorContent.getObject(0);
  332.    
  333.    // make sure it is saved...
  334.    if(!%obj.save(%name))
  335.    {
  336.       MessageBoxOK("GuiEditor Save Failure", "Failed to save '" @ %name @ "'. The file may be read-only.");
  337.    }
  338. }   
  339.  
  340. //----------------------------------------
  341. function GuiEdit(%val)
  342. {
  343.    if(%val != 0)
  344.       return;
  345.       
  346.    %content = Canvas.getContent();
  347.    
  348.    if(%content == GuiEditorGui.getId())
  349.    {
  350.       //GlobalActionMap.bind(mouse, button1, mouselook);
  351.  
  352.       %obj = GuiEditorContent.getObject(0);
  353.       if(%obj != -1)
  354.       {
  355.          GuiGroup.add(%obj);
  356.          //Canvas.setContent(%obj);
  357.          Canvas.setContent($previousContent);
  358.       }
  359.       echo("Exporting Gui Editor Prefs");
  360.       export( "$Pref::GuiEditor::*", "./prefs.cs", false );
  361.       GlobalActionMap.unbind( keyboard, "delete" );
  362.    }
  363.    else
  364.    {
  365.       $previousContent = %content;
  366.       exec("./prefs.cs");
  367.       //GlobalActionMap.unbind(mouse, button1);
  368.       GuiEditorOpen(%content);
  369.    }
  370. }
  371.  
  372. package GuiEditor_BlockDialogs
  373. {
  374.  
  375. function GuiCanvas::pushDialog()
  376. {
  377.  
  378. }
  379.  
  380. function GuiCanvas::popDialog()
  381. {
  382.  
  383. }
  384.  
  385. };
  386.  
  387. //----------------------------------------
  388. function GuiEditorOpen(%content)
  389. {
  390.    GuiEditorMenuBar.clearMenus();
  391.    GuiEditorMenuBar.addMenu("File", 0);
  392.    GuiEditorMenuBar.addMenuItem("File", "New GUI...", 1);
  393.    GuiEditorMenuBar.scriptCommand["File", 1] = "GuiEditorStartCreate();";
  394.    GuiEditorMenuBar.addMenuItem("File", "Save GUI...", 2);
  395.    GuiEditorMenuBar.scriptCommand["File", 2] = "GuiEditorSaveGui();";
  396.    GuiEditorMenuBar.addMenuItem("File", "-", 0);
  397.    GuiEditorMenuBar.addMenuItem("File", "GUI Editor Help...", 3, "F1");
  398.    GuiEditorMenuBar.scriptCommand["File", 3] = "getHelp(\"3. Gui Editor\");";
  399.    GuiEditorMenuBar.addMenuItem("File", "Toggle GUI Editor...", 4, "F10");
  400.    GuiEditorMenuBar.scriptCommand["File", 4] = "GuiEdit(0);";
  401.  
  402.    GuiEditorMenuBar.addMenu("Edit", 1);
  403.    GuiEditorMenuBar.addMenuItem("Edit", "Cut", 3, "Ctrl X");
  404.    GuiEditorMenuBar.scriptCommand["Edit", 3] = "GuiEditor.saveSelection($GUI::clipboardFile); GuiEditor.deleteSelection();";
  405.    GuiEditorMenuBar.setMenuItemBitmap("Edit", "Cut", 3);
  406.    GuiEditorMenuBar.addMenuItem("Edit", "Copy", 4, "Ctrl C");
  407.    GuiEditorMenuBar.scriptCommand["Edit", 4] = "GuiEditor.saveSelection($GUI::clipboardFile);";
  408.    GuiEditorMenuBar.setMenuItemBitmap("Edit", "Copy", 4);
  409.    GuiEditorMenuBar.addMenuItem("Edit", "Paste", 5, "Ctrl V");
  410.    GuiEditorMenuBar.scriptCommand["Edit", 5] = "GuiEditor.loadSelection($GUI::clipboardFile);";
  411.    GuiEditorMenuBar.setMenuItemBitmap("Edit", "Paste", 5);
  412.    GuiEditorMenuBar.addMenuItem("Edit", "-", 0);
  413.    GuiEditorMenuBar.addMenuItem("Edit", "Select All", 6, "Ctrl A");
  414.    GuiEditorMenuBar.scriptCommand["Edit", 6] = "GuiEditor.selectAll();";
  415.  
  416.    GuiEditorMenuBar.addMenu("Layout", 2);
  417.    GuiEditorMenuBar.addMenuItem("Layout", "Align Left", 1, "Ctrl L");
  418.    GuiEditorMenuBar.scriptCommand["Layout", 1] = "GuiEditor.Justify(0);";
  419.    GuiEditorMenuBar.addMenuItem("Layout", "Align Right", 2, "Ctrl R");
  420.    GuiEditorMenuBar.scriptCommand["Layout", 2] = "GuiEditor.Justify(2);";
  421.    GuiEditorMenuBar.addMenuItem("Layout", "Align Top", 3, "Ctrl T");
  422.    GuiEditorMenuBar.scriptCommand["Layout", 3] = "GuiEditor.Justify(3);";
  423.    GuiEditorMenuBar.addMenuItem("Layout", "Align Bottom", 4, "Ctrl B");
  424.    GuiEditorMenuBar.scriptCommand["Layout", 4] = "GuiEditor.Justify(4);";
  425.    GuiEditorMenuBar.addMenuItem("Layout", "-", 0);
  426.    GuiEditorMenuBar.addMenuItem("Layout", "Center Horizontally", 5);
  427.    GuiEditorMenuBar.scriptCommand["Layout", 5] = "GuiEditor.Justify(1);";
  428.    GuiEditorMenuBar.addMenuItem("Layout", "Space Vertically", 6);
  429.    GuiEditorMenuBar.scriptCommand["Layout", 6] = "GuiEditor.Justify(5);";
  430.    GuiEditorMenuBar.addMenuItem("Layout", "Space Horizontally", 7);
  431.    GuiEditorMenuBar.scriptCommand["Layout", 7] = "GuiEditor.Justify(6);";
  432.    GuiEditorMenuBar.addMenuItem("Layout", "-", 0);
  433.    GuiEditorMenuBar.addMenuItem("Layout", "Bring to Front", 8);
  434.    GuiEditorMenuBar.scriptCommand["Layout", 8] = "GuiEditor.BringToFront();";
  435.    GuiEditorMenuBar.addMenuItem("Layout", "Send to Back", 9);
  436.    GuiEditorMenuBar.scriptCommand["Layout", 9] = "GuiEditor.PushToBack();";
  437.    GuiEditorMenuBar.addMenuItem("Layout", "Lock Selection", 10);
  438.    GuiEditorMenuBar.scriptCommand["Layout",10] = "GuiEditorTreeView.lockSelection(true);";
  439.    GuiEditorMenuBar.addMenuItem("Layout", "Unlock Selection", 11);
  440.    GuiEditorMenuBar.scriptCommand["Layout",11] = "GuiEditorTreeView.lockSelection(false);";
  441.    GuiEditorMenuBar.addMenu("Move", 3);
  442.    GuiEditorMenuBar.addMenuItem("Move", "Nudge Left", 1, "Left");
  443.    GuiEditorMenuBar.scriptCommand["Move", 1] = "GuiEditor.moveSelection(-1,0);";
  444.    GuiEditorMenuBar.addMenuItem("Move", "Nudge Right", 2, "Right");
  445.    GuiEditorMenuBar.scriptCommand["Move", 2] = "GuiEditor.moveSelection(1,0);";
  446.    GuiEditorMenuBar.addMenuItem("Move", "Nudge Up", 3, "Up");
  447.    GuiEditorMenuBar.scriptCommand["Move", 3] = "GuiEditor.moveSelection(0,-1);";
  448.    GuiEditorMenuBar.addMenuItem("Move", "Nudge Down", 4, "Down");
  449.    GuiEditorMenuBar.scriptCommand["Move", 4] = "GuiEditor.moveSelection(0,1);";
  450.    GuiEditorMenuBar.addMenuItem("Move", "-", 0);
  451.    GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Left", 5, "Shift Left");
  452.    GuiEditorMenuBar.scriptCommand["Move", 5] = "GuiEditor.moveSelection(-10,0);";
  453.    GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Right", 6, "Shift Right");
  454.    GuiEditorMenuBar.scriptCommand["Move", 6] = "GuiEditor.moveSelection(10,0);";
  455.    GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Up", 7, "Shift Up");
  456.    GuiEditorMenuBar.scriptCommand["Move", 7] = "GuiEditor.moveSelection(0,-10);";
  457.    GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Down", 8, "Shift Down");
  458.    GuiEditorMenuBar.scriptCommand["Move", 8] = "GuiEditor.moveSelection(0,10);";
  459.  
  460.  
  461.    Canvas.setContent(GuiEditorGui);
  462.    while((%obj = GuiEditorContent.getObject(0)) != -1)
  463.       GuiGroup.add(%obj); // get rid of anything being edited
  464.  
  465.    %i = 0;
  466.    GuiEditorContentList.clear();
  467.    while((%obj = GuiGroup.getObject(%i)) != -1)
  468.    {
  469.       if(%obj.getName() !$= Canvas)
  470.       {
  471.          if(%obj.getName() $= "")
  472.             %name = "(unnamed) - " @ %obj;
  473.          else
  474.             %name = %obj.getName() @ " - " @ %obj;
  475.  
  476.          GuiEditorContentList.add(%name, %obj);
  477.       }
  478.       %i++;
  479.    
  480.       activatePackage(GuiEditor_BlockDialogs);
  481.       GuiEditorContent.add(%content);
  482.       deactivatePackage(GuiEditor_BlockDialogs);
  483.       GuiEditorContentList.sort();
  484.    }
  485.    
  486.    GuiEditorClassPopup.sort();
  487.    GuiEditorResList.clear();
  488.    GuiEditorResList.add("640 x 480", 640);
  489.    GuiEditorResList.add("800 x 600", 800);
  490.    GuiEditorResList.add("1024 x 768", 1024);
  491.    %ext = $Pref::GuiEditor::PreviewResolution;
  492.    if( %ext $= "" )
  493.    {
  494.    %ext = GuiEditorRegion.getExtent();
  495.    echo("extent is " @ %ext );
  496.    switch(getWord(%ext, 0))
  497.    {
  498.       case 640:
  499.          GuiEditorResList.setText("640 x 480");
  500.       case 800:
  501.          GuiEditorResList.setText("800 x 600");
  502.       case 1024:
  503.          GuiEditorResList.setText("1024 x 768");
  504.    }
  505.    }
  506.    else
  507.    {
  508.       GuiEditorResList.setText( getWord(%ext,0) @ " x " @ getWord(%ext, 1) );
  509.    }
  510.    if(%content.getName() $= "")
  511.       %name = "(unnamed) - " @ %content;
  512.    else
  513.       %name = %content.getName() @ " - " @ %content;
  514.    
  515.    GuiEditorContentList.setText(%name);
  516.    GuiEditorClassPopup.setText("New Control");
  517.    GuiEditor.setRoot(%content);
  518.    GuiEditorRegion.resize(0,0,getWord(%ext,0), getWord(%ext, 1));
  519.    GuiEditorContent.getObject(0).resize(0,0,getWord(%ext,0), getWord(%ext, 1));
  520.  
  521. //   %content.resize(0,0,getWord(%ext,0), getWord(%ext, 1));
  522.  
  523.    GuiEditorTreeView.open(%content);
  524.  
  525. }
  526.  
  527. function GuiEditorMenuBar::onMenuItemSelect(%this, %menuId, %menu, %itemId, %item)
  528. {
  529.    if(%this.scriptCommand[%menu, %itemId] !$= "")
  530.       eval(%this.scriptCommand[%menu, %itemId]);
  531.    else
  532.       error("No script command defined for menu " @ %menu  @ " item " @ %item);
  533. }
  534.  
  535. //----------------------------------------
  536. function GuiEditorContentList::onSelect(%this, %id)
  537. {
  538.    GuiEditorOpen(%id);
  539. }
  540.  
  541. //----------------------------------------
  542. function GuiEditorClassPopup::onSelect(%this, %id)
  543. {
  544.    %class = %this.getText();
  545.    %obj = eval("return new " @ %class @ "();");
  546.    GuiEditor.addNewCtrl(%obj);
  547.    GuiEditorClassPopup.setText("New Control");
  548. }
  549.  
  550. function GuiEditorResList::onSelect(%this, %id)
  551. {
  552.    switch(%id)
  553.    {
  554.       case 640:
  555.          GuiEditorRegion.resize(0,0,640,480);
  556.          GuiEditorContent.getObject(0).resize(0,0,640,480);
  557.          $Pref::GuiEditor::PreviewResolution = "640 480";
  558.       case 800:
  559.          GuiEditorRegion.resize(0,0,800,600);
  560.          GuiEditorContent.getObject(0).resize(0,0,800,600);
  561.          $Pref::GuiEditor::PreviewResolution = "800 600";
  562.       case 1024:
  563.          GuiEditorRegion.resize(0,0,1024,768);
  564.          GuiEditorContent.getObject(0).resize(0,0,1024,768);
  565.          $Pref::GuiEditor::PreviewResolution = "1024 768";
  566.    }
  567. }
  568.  
  569. //----------------------------------------
  570. // defines the icons to be used in the tree view control
  571. // provide the paths to each icon minus the file extension
  572. // seperate them with : 
  573. // the order of the icons must correspond to the bit array defined
  574. // in the GuiTreeViewCtrl.h
  575. function GuiEditorTreeView::onDefineIcons(%this)
  576. {
  577.    //%icons = "common/ui/shll_icon_passworded_hi:common/ui/shll_icon_passworded:common/ui/shll_icon_notqueried_hi:common/ui/shll_icon_notqueried:common/ui/shll_icon_favorite_hi:common/ui/shll_icon_default:";
  578.    //GuiEditorTreeView.buildIconTable(%icons);
  579. }
  580.  
  581. function GuiEditorTreeView::onRightMouseDown(%this, %item, %pts, %obj)
  582. {
  583.    if(%obj)
  584.    {
  585.       GuiEditor.setCurrentAddSet(%obj);
  586.    }
  587. }
  588.  
  589. function GuiEditorTreeView::onAddSelection(%this,%ctrl)
  590. {
  591.    GuiEditor.addSelection(%ctrl);
  592. }
  593.  
  594. function GuiEditorTreeView::onRemoveSelection(%this,%ctrl)
  595. {
  596.    GuiEditorTreeView.removeSelection(%ctrl);
  597. }
  598.  
  599. function GuiEditor::onClearSelected(%this)
  600.    GuiEditorTreeView.clearSelection();
  601. }
  602.  
  603. function GuiEditor::onAddSelected(%this,%ctrl)
  604. {
  605.    GuiEditorTreeView.addSelection(%ctrl);
  606. }
  607.  
  608. function GuiEditor::onRemoveSelected(%this,%ctrl)
  609. {
  610.    GuiEditorTreeView.removeSelection(%ctrl); 
  611. }
  612.  
  613. function GuiEditor::onDelete(%this)
  614. {
  615.    GuiEditorTreeView.deleteSelection();
  616. }
  617.  
  618. function GuiEditorTreeView::onDeleteSelection(%this)
  619.    GuiEditor.clearSelection();
  620. }
  621.  
  622. function GuiEditorTreeView::onSelect(%this, %obj)
  623. {
  624.    if(isObject(%obj))
  625.    {
  626.       GuiEditorInspectFields.inspect(%obj);
  627.       GuiEditorInspectName.setValue(%obj.getName());
  628.       GuiEditor.select(%obj);
  629.    }
  630. }
  631.  
  632. //----------------------------------------
  633. function GuiEditorInspectApply()
  634. {
  635.    GuiEditorInspectFields.setName(GuiEditorInspectName.getValue());
  636. }
  637.  
  638. //----------------------------------------
  639. function GuiEditor::onSelect(%this, %ctrl)
  640. {  
  641.    GuiEditorInspectFields.inspect(%ctrl);
  642.    GuiEditorInspectName.setValue(%ctrl.getName());
  643.    GuiEditor.clearSelection();
  644.    GuiEditor.select(%ctrl);
  645.    GuiEditorTreeView.addSelection(%ctrl); 
  646. }
  647.  
  648. //----------------------------------------
  649. //function GuiEditorDeleteSelected( %val ) {
  650. //  if( %val )
  651. //    GuiEditor.deleteSelection();
  652. //}      
  653.  
  654. GlobalActionMap.bind(keyboard, "f10", GuiEdit);
  655.